home *** CD-ROM | disk | FTP | other *** search
/ Revista do CD-ROM 101 / CD-ROM 101.iso / compl / maya5ple / Install_MayaPLE5_English.exe / Maya / Data1.cab / selectAllInputOutput.mel < prev    next >
Encoding:
Text File  |  2003-07-17  |  2.7 KB  |  102 lines

  1. // Copyright (C) 1997-2002 Alias|Wavefront,
  2. // a division of Silicon Graphics Limited.
  3. //
  4. // The information in this file is provided for the exclusive use of the
  5. // licensees of Alias|Wavefront.  Such users have the right to use, modify,
  6. // and incorporate this code into other products for purposes authorized
  7. // by the Alias|Wavefront license agreement, without fee.
  8. //
  9. // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  10. // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  11. // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  12. // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  13. // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  14. // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  15. // PERFORMANCE OF THIS SOFTWARE.
  16. //
  17. //
  18. //  Alias|Wavefront Script File
  19. //  MODIFY THIS AT YOUR OWN RISK
  20. //
  21. //  Creation Date:  5 Apr 1996
  22. //  Author:         ms
  23. //
  24. //  Description:
  25. //      This procedure selects history/future of the object
  26.  
  27. proc string needTheLead()
  28. {
  29.     string $result = "";
  30.     string $all[] = `ls -l -sl -tail 1 -type dagNode`;
  31.     if( size($all) > 0 ) {
  32.         $result = $all[0];
  33.     }
  34.     else {
  35.         $all = `ls -sl -tail 1`;
  36.         if( size($all) > 0 ) {
  37.             $result = $all[0];
  38.         }
  39.     }
  40.     return $result;
  41. }
  42.  
  43.  
  44. proc string fillOutSection( string $chain[] )
  45. {
  46.     string $cmdString = "";
  47.     string $item, $each;
  48.     string $list[];
  49.     int $n;
  50.  
  51.     for( $item in $chain ) {
  52.         tokenize( $item, "|", $list );
  53.         $n = size($list);
  54.         if( 1 == $n ) {
  55.             $cmdString = ( $cmdString + " \"" + $item + "\"" );
  56.         }
  57.         else if( $n > 0 ) {
  58.             for( $each in $list ) {
  59.                 $cmdString = ( $cmdString + " \"" + $each + "\"" );
  60.             }
  61.         }
  62.     }
  63.  
  64.     return $cmdString;
  65. }
  66.  
  67. proc string selectInputOutputGiven( string $lead, int $future )
  68. {
  69.     string $chainFalse[];
  70.     string $chainTrue[];
  71.     string $cmdString;
  72.  
  73.     int $showLevel = 2;
  74.     int $pruneDag = 1;
  75.  
  76.     if( "" != $lead ) {
  77.         if( "transform" == `nodeType $lead`) {
  78.             $chainFalse2 = `listHistory -gl true -pdo $pruneDag -lf false
  79.                 -f $future -il $showLevel $lead`;
  80.             $cmdString = fillOutSection( $chainFalse2 );
  81.         }
  82.         $chainTrue2 = `listHistory -gl true -pdo $pruneDag -lf true
  83.             -f $future -il $showLevel $lead`;
  84.         $cmdString = $cmdString + fillOutSection( $chainTrue2 );
  85.  
  86.         eval( "select -add " + $cmdString + "");
  87.     }
  88.     return $cmdString;
  89. }
  90.  
  91. global proc string selectAllInputOutput( int $future )
  92. //
  93. // Select all objects in the history (input) if flag is false
  94. // or future (output) if flag is true of the lead object selected.
  95.  
  96. {
  97.     // Get the list of selected items and do the list
  98.     // for the lead/last item.
  99.     //
  100.     return selectInputOutputGiven( `needTheLead`, $future );
  101. }
  102.